package com.ly.hotel.spainterface.jyt.utils;

import com.ly.hotel.common.MyApplication;
import com.ly.hotel.spainterface.jyt.bean.MachineInfo;

/**
 * Created by ThinkPad on 2018/3/17.
 * 获取电视信息工具类
 */

public class MachineInfoUtils {

    public static MachineInfo getHostAndTvInfo(){
        String hostString = MyApplication.getHostIpAndPort();
        String mac = MyApplication.getMAC();
        String categoryName =MyApplication.getDeviceInfo().getCategoryName();
        String tvName = MyApplication.getDeviceInfo().getName();
        MachineInfo machineInfo = null;
        if(hostString != null && mac !=  null && categoryName != null && tvName != null){
            machineInfo = new MachineInfo();
            String[] host = hostString.split(":");
            machineInfo.setServerIP(host[0]);
            machineInfo.setServerPORT(host[1]);
            machineInfo.setMac(mac);
            machineInfo.setCategoryName(categoryName);
            machineInfo.setTvName(tvName);
        }
        return machineInfo;
    }
}
